#include <Eigen/Sparse>
#include <Eigen/src/Core/Matrix.h>
#include <iostream>
#include "Function.hpp"

using namespace Eigen;

template<int dim>
class F1 : public Function<dim> {
  public:
  double operator() (const Eigen::Vector<double, dim> &point) const override{
    return point(0);
  }
};

int main()
{
  Eigen::SparseMatrix<float, Eigen::RowMajor> A;
  A = MatrixXf::Random(5,5).sparseView();
  A.prune([](int i, int j, float) { return i!=1 && j!=2; });
  std::cout << A << "\n";
  Eigen::Matrix2d m;
  m << 1,2,3,4;
  Eigen::Vector<double, 2> v = {0,1};
  std::cout << "m is : " << m << std::endl;
  std::cout << "v is : " << v << std::endl;
  std::cout << "m*v is " << v.transpose()*m << std::endl;
  F1<2> ftn;
  std::cout << "ftn(v) = " << ftn(v) << std::endl;
  std::cout << "grad_ftn(v) = " << ftn.gradient(v) << std::endl;
  int n = 0;
  switch (n) {
  case 0:
    std::cout << "case 0" << std::endl;
    return 1;
  case 1:
    std::cout << "case 1" << std::endl;
    return 1;
  }
}
